package com.black.cat.jvm;

import java.io.IOException;

/**
 * @Author blackcat
 * @create 2021/8/11 15:12
 * @version: 1.0
 * @description:测试类
 */
public class MainTest {

    public static int staticVar;
    public int instanceVar;

    public static void main(String[] args) throws IOException {
        int x = 32768; // ldc
        MainTest myObj = new MainTest(); // new
        MainTest.staticVar = x; // putstatic
        x = MainTest.staticVar; // getstatic
        myObj.instanceVar = x; // putfield
        x = myObj.instanceVar; // getfield
        Object obj = myObj;
        if (obj instanceof MainTest) { // instanceof
            myObj = (MainTest) obj; // checkcast
            System.out.println(myObj.instanceVar);
        }
    }


}
